#include <vcl.h>
#pragma hdrstop


#include <System.hpp>


struct TDeputy;




struct TDeputy {
  int calmness;
  int friendsCount;
  int friends [ 100000/*# range 1..100000*/ ];
  bool inFight;
};



int i = 0, j = 0, n1 = 0, n2 = 0, m1 = 0, m2 = 0, k1 = 0, k2 = 0;
TDeputy a[ 100000/*# range 1..100000*/ ], B[ 100000/*# range 1..100000*/ ];
int p[ 100000/*# range 1..100000*/ ], q[ 100000/*# range 1..100000*/ ];
int x = 0, y = 0;

int main(int argc, char* argv[])
{
  Read( n1 ); ReadLn( n2 );
  for ( int stop = n1, i = 1; i <= stop; i++)
  {
    Read( a[i - 1].calmness );
    a[i - 1].inFight = false;
    a[i - 1].friendsCount = 0;
  }
  for ( int stop = n2, i = 1; i <= stop; i++)
  {
    Read( B[i - 1].calmness );
    B[i - 1].inFight = false;
    B[i - 1].friendsCount = 0;
  }
  Read( m1 ); ReadLn( m2 );
  for ( int stop = m1, i = 1; i <= stop; i++)
  {
    Read( x ); Read( y );
    af[x][ y] = true;
    af[y][ x] = true;
  }
  for ( int stop = m2, i = 1; i <= stop; i++)
  {
    Read( x ); Read( y );
    bf[x][ y] = true;
    bf[y][ x] = true;
  }
  Read( k1 ); ReadLn( k2 );
  for ( int stop = k1, i = 1; i <= stop; i++)
    Read( p[i - 1] );
  for ( int stop = k2, i = 1; i <= stop; i++)
    Read( q[i - 1] );
  for ( int stop = k1, i = 1; i <= stop; i++)
    aa[p[i - 1]] = true;
  for ( int stop = k2, i = 1; i <= stop; i++)
    bb[q[i - 1]] = true;
  for ( int stop = n1, i = 1; i <= stop; i++)
    for ( int stop = m2, i = 1; i <= stop; i++)
      Read( B[i - 1] );
  for ( int stop = n, i = 1; i <= stop; i++)
    for ( int stop = n1, i = 1; i <= stop; i++)
      Read( a[i - 1] );
  Read( B[i - 1] );
  for ( int stop = n, i = 1; i <= stop; i++)
    s = s - abs( a[i - 1] - B[i - 1] );
  WriteLn( s, 0, 0 );
  return 0;
}
